package com.mccken.eshop.order.controller;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.mccken.eshop.common.code.JsonResult;
import com.mccken.eshop.order.api.OrderApi;
import com.mccken.eshop.order.domain.request.CreateOrderParams;
import com.mccken.eshop.order.domain.request.GenOrderIdParams;
import com.mccken.eshop.order.domain.response.CreateOrderResult;
import com.mccken.eshop.order.domain.response.GenOrderIdResult;

import lombok.extern.slf4j.Slf4j;

/**
 * 正向下单流程接口冒烟测试
 * 
 * @program: mccken-collect
 * @description:
 * @author: mccken
 * @create: 2022-08-27 22:54
 **/
@RestController
@Slf4j
@RequestMapping("/order/test")
public class OrderTestController {

	/**
	 * 订单服务
	 */
//	@DubboReference(version = "1.0.0", retries = 0)
	private OrderApi orderApi;

	@PostMapping("/genOrderId")
	public JsonResult<GenOrderIdResult> genOrderId(@RequestBody GenOrderIdParams params) {
		JsonResult<GenOrderIdResult> result = orderApi.genOrderId(params);
		return result;
	}

	/**
	 * 测试提交订单
	 */
	@PostMapping("/createOrder")
	public JsonResult<CreateOrderResult> createOrder(@RequestBody CreateOrderParams params) {
		JsonResult<CreateOrderResult> result = orderApi.createOrder(params);
		return result;
	}
	
}
